//
//  EditierViewController.m
//  EditorTextFiled
//
//  Created by Gamefire on 16/4/28.
//  Copyright © 2016年 Gamefire. All rights reserved.
//

#import "EditierViewController.h"
#import "PersonViewController.h"

#import "WULIChangeUserInfoAPI.h"

@interface EditierViewController (){

    UIView * navbar;
    UIButton *rightButton;
    UILabel *namelabel;
    UIImageView *leftimageView;
    UIButton *leftbtn;
    UITextField *_textfiled;
    UILabel *_backLabel;
}


@end


@implementation EditierViewController
- (void)loadView{
    [super loadView];
    
    self.navigationController.navigationBarHidden = YES;
    [self.view setBackgroundColor:[UIColor colorWithRed:236.0/255.0 green:236.0/255.0 blue:236.0/255.0 alpha:1]];
    
    navbar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 64)];
    
    [self.view addSubview:navbar];
    
    namelabel = [[UILabel alloc] initWithFrame:CGRectMake(navbar.bounds.size.width / 2.0 - 33.5, 28, 67, 20)];
    
    [navbar addSubview:namelabel];
    
    
    rightButton = [[UIButton alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 50, 12.5, 50, 50)];
//    [rightButton setBackgroundColor:[UIColor orangeColor]];
    [self.view addSubview:rightButton];
    
    
    _textfiled = [[UITextField alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(navbar.frame) + 60, [UIScreen mainScreen].bounds.size.width -20, 44)];
    [self.view addSubview:_textfiled];
    
    leftimageView = [[UIImageView alloc] initWithFrame:CGRectMake(8, 29, 10, 19)];
    [navbar addSubview:leftimageView];
    

    leftbtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 65, 65)];
    [navbar addSubview:leftbtn];
    
    _backLabel = [[UILabel alloc] initWithFrame:CGRectMake(22, 26, 33, 24)];
    [navbar addSubview:_backLabel];
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
    [navbar setBackgroundColor:[UIColor colorWithRed:242.0 /255.0 green:202.0 /255.0 blue:48.0/255.0 alpha:1]];
    
    [namelabel setText:@"修改昵称"];
    [namelabel setFont:[UIFont systemFontOfSize:16.0]];
    
    [rightButton setTitle:@"完成" forState:UIControlStateNormal];
    [rightButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [rightButton.titleLabel setFont:[UIFont systemFontOfSize:15.0]];
    [rightButton addTarget:self action:@selector(Event:) forControlEvents:UIControlEventTouchUpInside];
    
    [_textfiled setBorderStyle:UITextBorderStyleNone];
    [_textfiled setText:_tString];
    [_textfiled setFont:[UIFont systemFontOfSize:15.0]];
    [_textfiled setPlaceholder:@"  输入名字"];
    [_textfiled setBackgroundColor:[UIColor whiteColor]];
    
    [leftimageView setImage:[UIImage imageNamed:@"Detalback"]];
    
    
    [_backLabel setTextAlignment:NSTextAlignmentCenter];
    [_backLabel setFont:[UIFont systemFontOfSize:15.0]];
    [_backLabel setText:@"返回"];
   
    
//    [leftbtn setTitle:@"返回" forState:UIControlStateNormal];
//    [leftbtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [leftbtn.titleLabel setFont:[UIFont systemFontOfSize:15.0]];
    [leftbtn addTarget:self action:@selector(leftEvent) forControlEvents:UIControlEventTouchUpInside];

}



- (void)Event:(UIButton *)btn{

    [self.view endEditing:YES];
     [self.navigationController popViewControllerAnimated:YES];
    
}


- (void)leftEvent{
    
    [self.navigationController popViewControllerAnimated:YES];

}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    [self.view endEditing:YES];
    [super touchesBegan:touches withEvent:event];
   

}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
